<%#
  # WebROaR - Ruby Application Server - http://webroar.in/
  # Copyright (C) 2009  Goonj LLC
  #
  # This file is part of WebROaR.
  #
  # WebROaR is free software: you can redistribute it and/or modify
  # it under the terms of the GNU General Public License as published by
  # the Free Software Foundation, either version 3 of the License, or
  # (at your option) any later version.
  #
  # WebROaR is distributed in the hope that it will be useful,
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  # GNU General Public License for more details.
  #
  # You should have received a copy of the GNU General Public License
  # along with WebROaR.  If not, see <http://www.gnu.org/licenses/>.
  #%>

  <%= form_for :smtp, :html => { :onsubmit => 'return validate_smtp(this)'},:url => {:controller => 'mail_specification', :action => 'save_smtp_settings'} do%>
    <table width = 95% align='center'>
      <tr>
        <th width = 50% colspan = 2><b>Mail Settings</b>&nbsp;&nbsp;&nbsp;
            <%=link_to_function('Help', :onclick => 'addHelp("mail",event);')%>
        </th>
        <th wdth = 50% colspan = 2><%=link_to_remote 'Sendmail', :update => 'mail_div', :url => {:controller => 'mail_specification', :action => 'sendmail_form'}%></th>
      </tr>
      <tr>
        <td colspan = 4 id = 'error_div_smtp_form' style="padding:0px;"><%=flash[:smtp_errors]%></td>
      </tr>
      <tr>
        <td >SMTP Server<span id = 'needed'>*</span> &nbsp;&nbsp;&nbsp;
            <%=link_to_function('Help', :onclick => 'addHelp("smtp_server",event);')%>
        </td>
        <td><%=text_field :smtp, :address, :size => 20, :value => @smtp_old['address']%></td>
        <td>SMTP Port<span id = 'needed'>*</span> &nbsp;&nbsp;&nbsp;</td>
        <td><%=text_field :smtp, :port, :size => 20, :value => @smtp_old['port']%></td>
      </tr>
      <tr>
        <td>SMTP Domain<span id = 'needed'>*</span> &nbsp;&nbsp;&nbsp;
            <%=link_to_function('Help', :onclick => 'addHelp("smtp_domain",event);')%>
        </td>
        <td><%=text_field :smtp, :domain, :size => 20, :value => @smtp_old['domain']%></td>
        <td>SMTP Authentication<span id = 'needed'>*</span>
            <%=link_to_function('Help', :onclick => 'addHelp("smtp_authentication",event);')%>
        </td>
        <td><%=text_field :smtp, :authentication, :size => 20, :value => @smtp_old['authentication']%></td>  
      </tr>
      <tr>
        <td>SMTP Username<span id = 'needed'>*</span> &nbsp;&nbsp;&nbsp;
            <%=link_to_function('Help', :onclick => 'addHelp("smtp_username",event);')%>
        </td>
        <td><%=text_field :smtp, :user_name, :size => 20, :value => @smtp_old['user_name']%></td>
        <td>SMTP Password<span id = 'needed'>*</span> &nbsp;&nbsp;&nbsp;
            <%=link_to_function('Help', :onclick => 'addHelp("smtp_password",event);')%>
        </td>
        <td><%=password_field :smtp, :password, :size => 20, :value => @smtp_old['password']%></td>
      </tr>
      <tr>
        <td>Sender's Email Address<span id = 'needed'>*</span> &nbsp;&nbsp;&nbsp;</td>
        <td><%=text_field :smtp, :from, :size => 20, :value => @smtp_old['from']%></td>
        <td>Recipient Email Addresses<span id = 'needed'>*</span> &nbsp;&nbsp;&nbsp;
            <%=link_to_function('Help', :onclick => 'addHelp("smtp_recipients_id",event);')%>
        </td>
        <td><%=text_field :smtp, :recipients, :size => 20, :value => @smtp_old['recipients']%></td>
      </tr>
      <tr>
        <td style="text-align:center;" colspan = 4><%=submit_tag 'Save'%>&nbsp;&nbsp;&nbsp;&nbsp;<%=button_to_function 'Cancel', 'window.location.reload();'%></td>
      </tr>
    </table>
  <%end%>
  <br><br>
